public class Main {
    public static void main(String[] args) {
        MyList myList=new MyList();
        myList.addLast(1);
        myList.addLast(2);
        myList.addLast(3);
        myList.foreach();
        myList.add(1,5);
        myList.foreach();
        int remove= myList.remove(2);
        System.out.println(remove);
        myList.foreach();
    }
}